@keyframes leftToRight {
  0%,
  25% {
    transform: translateX(0%);
    left: 0%;
  }
  75%,
  100% {
    transform: translateX(-100%);
    left: 100%;
  }
}

#root,
.fast-settings,
.tray,
.wlan-selector,
.media-control,
.notifications,
.notification-arrival,
.calendar-container {
  font-size: 0.8rem;
  font-weight: 500;

  --popups-margin: 4px;

  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    background-color: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background-color: var(--color-gray-400);
    border-radius: 8px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-gray-500);
  }
}

@keyframes PopupBaseAnimation {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}


.notification-open, .settings-open, .calendar-open, .tray-open, .wlan-open, .media-open, .media-notifier-open, .ft-bar-item-context-menu-open, .ft-bar-context-menu-open, 
.notification-close, .settings-close, .calendar-close, .tray-close, .wlan-close, .media-close, .media-notifier-close, .ft-bar-item-context-menu-close, .ft-bar-context-menu-close {
 animation: PopupBaseAnimation 0.2s linear forwards; 
}

.notification-close, .settings-close, .calendar-close, .tray-close, .wlan-close, .media-close, .ft-bar-item-context-menu-close, .ft-bar-context-menu-close {
  animation-direction: reverse;
}

.ft-bar {
  color: #fefefe;

  .ft-bar-bg-layer-1 {
    opacity: 0.3;
    filter: saturate(0);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='10' numOctaves='3' stitchTiles='stitch '/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    background-size: cover;
  }

  .ft-bar-bg-layer-2 {
    background-color: #121212bb;
  }
}

.ft-bar-item {
  .workspace-dot {
    background-color: #efefef;
    transition-property: width, border-radius, background-color;
    transition-duration: 200ms;
    transition-timing-function: ease-out;

    &.workspace-dot-active {
      background-color: var(--config-accent-color);
    }
  }
}

.ft-bar-item-context-menu-container,
.tb-context-menu-container {
  min-width: 160px;

  .bg-layer-1 {
    background-color: var(--color-gray-100);
    border-radius: 10px;
  }
}

.ft-bar-item-clickable {
  padding: 1px 4px;
  border-radius: 6px;

  &:hover {
    backdrop-filter: brightness(3);
  }
}

.ft-bar-item-active {
  color: var(--config-accent-color);
}

.ft-bar-item-content {
  position: relative;
}

.ft-bar-item-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(25%, -25%);
  background-color: var(--config-accent-color);
  color: #efefef;
  height: 12px;
  min-width: 12px;
  font-size: 10px;
  border-radius: 8px;
}

.fast-settings {
  padding: 12px 16px;
  margin: var(--popups-margin);

  .fast-settings-bg-layer-1 {
    background-color: var(--color-gray-50);
    border-radius: 10px;
  }
}

.fast-settings-item-button {
  border: 1px solid var(--color-gray-600);
  border-radius: 8px;

  &:hover {
    background-color: var(--color-gray-200);
  }
}

.tray {
  margin: var(--popups-margin);

  .tray-bg-layer-1 {
    background-color: var(--color-gray-50);
    border-radius: 10px;
    box-shadow: 0 0 10px 10px #0001;
  }
}

.tray-list {
  padding: 10px;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  gap: 4px;
}

.tray-item {
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 8px;
  gap: 6px;
  height: min-content;

  &:hover {
    background-color: rgba(var(--config-accent-color-rgb), 0.2);
  }
}

.tray-item-icon {
  width: 1rem;
  height: 1rem;
  min-height: 1rem;
  min-width: 1rem;
}

.tray-item-label {
  font-size: 0.7rem;
  font-weight: 600;
}

.tray-item-label-tooltip {
  padding: 0 40px;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.wlan-selector {
  margin: var(--popups-margin);
  width: 260px;
  box-shadow: 0 0 10px 10px #0001;
  display: flex;
  flex-direction: column;

  .wlan-selector-bg-layer-1 {
    background-color: var(--color-gray-50);
    border-radius: 10px;
  }

  .wlan-selector-title {
    font-size: 0.8rem;
    color: var(--color-gray-600);
    font-weight: 600;
    padding: 8px 14px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .wlan-selector-refresh {
    animation: rotate 1s linear infinite;
  }
}

.wlan-selector-entries {
  padding: 8px;
  overflow-y: auto;
  border-bottom: 1px solid var(--color-gray-300);
  max-height: 30vh;

  .wlan-selector-empty {
    font-style: italic;
  }
}

.wlan-entry {
  min-height: min-content;
  padding: 12px 10px;
  border-radius: 8px;
  gap: 10px;

  &:hover {
    background-color: var(--color-gray-200);
  }

  &.wlan-entry-selected {
    background-color: rgba(var(--config-accent-color-rgb), 0.2);
  }
}

.wlan-entry-info {
  font-weight: 600;
  gap: 8px;

  .wlan-entry-info-ssid {
    flex: 1;
    color: var(--color-gray-800);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .wlan-entry-info-channel {
    font-size: 0.5rem;
    color: var(--color-gray-600);
    border: 1px solid var(--color-gray-600);
    border-radius: 4px;
    padding: 2px 4px;
  }
}

.wlan-selector-footer {
  padding: 8px;
  font-weight: 600;
  font-size: 0.8rem;

  > span {
    padding: 2px 6px;
    border-radius: 4px;

    &:hover {
      background-color: var(--color-gray-200);
    }
  }
}

.media-control {
  margin: var(--popups-margin);
  width: 300px;
  padding: 10px;

  .bg-layer-1 {
    background-color: var(--color-gray-50);
    border-radius: 10px;
  }

  .media-device-group {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 20vh;
    gap: 6px;

    .media-device {
      display: grid;
      align-items: center;
      grid-template-columns: 50px 1fr;
      gap: 6px;
    }
  }
}

.media-notifier {
  margin: var(--popups-margin);
  width: 240px;
  padding: 6px 24px 6px 6px;

  .bg-layer-1 {
    background-color: var(--color-gray-50);
    border-radius: 10px;
  }
}

.media-control-volume {
  display: flex;
  gap: 4px;
  align-items: center;
  width: 100%;
}

.fast-settings-label,
.media-control-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-gray-600);
  margin-bottom: 4px;
  display: block;
  width: 100%;

  &:not(:first-of-type) {
    margin-top: 10px;
    padding-top: 4px;
    border-top: solid 1px var(--color-gray-300);
  }
}

.media-device {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--color-gray-700);
}

.media-control-session-list {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  gap: 4px;
}

.media-session {
  display: grid;
  grid-template-columns: 80px 1fr;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  padding: 8px;
  gap: 8px;
  height: min-content;
}

.media-session-thumbnail-container {
  position: relative;
  z-index: 2;
  width: 100%;
}

.media-session-app-icon {
  position: absolute;
  z-index: 3;
  width: 25%;
  aspect-ratio: 1/1;
  right: 5%;
  bottom: 5%;
  object-fit: contain;
}

.media-session-thumbnail {
  border-radius: 8px;
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: contain;
  background: #0004;
}

.media-session-blurred-thumbnail {
  filter: blur(15px) brightness(125%) contrast(125%);
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.media-session-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
}

.media-session-title,
.media-session-author {
  position: relative;
  align-self: flex-start;
  font-size: 0.7rem;
  text-align: center;
  min-width: 100%;
  animation: leftToRight 5s infinite alternate ease-in-out;
}

.media-session-title {
  font-weight: 600;
  font-size: 1rem;
}

.media-session-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.notifications {
  margin: var(--popups-margin);
  width: 350px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - var(--config-height) - (var(--popups-margin) * 2));

  .bg-layer-1 {
    opacity: 0.4;
    filter: saturate(0);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='10' numOctaves='3' stitchTiles='stitch '/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    background-size: cover;
    border-radius: 12px;
  }

  .bg-layer-2 {
    opacity: 0.95;
    background-color: var(--color-gray-50);
    border-radius: 12px;
  }
}

@keyframes text-highlight {
  0% {
    color: var(--color-gray-300);
  }
  66% {
    color: var(--config-accent-color);
  }
  100% {
    color: var(--color-gray-300);
  }
}

.notification-arrival {
  margin: var(--popups-margin);
  width: 350px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - var(--config-height) - (var(--popups-margin) * 2));
  padding: 0 2px;
  overflow-y: hidden;
  overflow-x: hidden;

  & .notification-header-info {
    animation: text-highlight 5s ease-in-out infinite;
  }
}

.notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.notifications-body {
  overflow-y: auto;
  padding: 5px 10px;
  margin: 0 -10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notifications-footer {
  > button {
    font-size: 0.8rem;
    font-weight: 600;
  }
}

.notifications-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gray-500);
  font-weight: 600;
  font-size: 0.8rem;
}

.notification {
  border-radius: 12px;
  background-color: var(--color-gray-100);
  box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.4);
  padding: 10px;
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 5px;
  border-bottom: solid 1px var(--color-gray-300);
  margin-bottom: 5px;
}

.notification-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--color-gray-800);
}

.notification-icon {
  width: 1.5em;
}

.notification-body {
  word-break: break-word;

  .notification-body-title {
    font-weight: 600;
  }
}

.calendar-container {
  margin: var(--popups-margin);
  width: 350px;
  padding: 10px;

  .bg-layer-1 {
    background-color: var(--color-gray-50);
    border-radius: 12px;
  }

  .calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;

    .calendar-date {
      font-size: 1.2em;
      text-transform: capitalize;
      transition: 0.2s ease-in;
      transition-property: color, background-color;
      border-radius: 4px;
      padding: 0 4px;

      &:hover {
        color: var(--config-accent-color);
        background-color: var(--color-gray-200);
      }
    }

    .calendar-actions {
      display: flex;
      align-items: center;
      gap: 2px;

      .calendar-navigator {
        font-size: 1.2em;
        padding: 3px 8px;
        cursor: pointer;
        background-color: transparent;
        transition: 0.2s ease-in;
        transition-property: color, background-color;
        border-radius: 4px;

        &:hover {
          color: var(--config-accent-color);
          background-color: var(--color-gray-200);
        }
      }
    }
  }

  .calendar-cell-value {
    --margin: 4px;
    position: relative;
    transition: background-color 0.2s ease-in;
    border-radius: 4px;
    width: calc(100% - (var(--margin) * 2));
    height: calc(100% - (var(--margin) * 2));
    display: flex;
    justify-content: center;
    align-items: center;
    margin: var(--margin);

    &.calendar-cell-selected {
      background-color: var(--color-gray-100);
      color: var(--config-accent-color);
    }

    &:hover {
      background-color: var(--color-gray-200);
    }

    &.calendar-cell-today {
      background-color: rgba(var(--config-accent-color-rgb), 0.2);
    }

    &.calendar-cell-month {
      text-transform: capitalize;
    }
  }
}
